Namespace Actions
    Public MustInherit Class ActionItem
        Public ReadOnly OwnerAction As Action
        Public ReadOnly Configuration As XmlHelper

        Public ReadOnly Property Comment() As String
            Get
                Return Configuration.Attribute("comment", "")
            End Get
        End Property

        Function ParsedAttribute(ByVal AttributeName As String, Optional ByVal DefaultValue As String = "") As String
            Return OwnerAction.InsertParams(Configuration.Attribute(AttributeName, DefaultValue))
        End Function

        Public Sub New(ByVal Owner As Action, ByVal Definition As Xml.XmlNode)
            Me.OwnerAction = Owner
            Me.Configuration = New XmlHelper(Definition)
        End Sub

        MustOverride Sub Execute()

        Protected Sub LogMessage(ByVal what As String)
            If Not OwnerAction Is Nothing Then OwnerAction.LogMessage(what)
        End Sub
        Protected Sub LogException(ByVal what As Exception)
            If Not OwnerAction Is Nothing Then OwnerAction.LogException(what)
        End Sub
    End Class

    < _
    System.AttributeUsage( _
      System.AttributeTargets.Class, _
      AllowMultiple:=True, _
      Inherited:=True) _
    > _
    Public Class ActionItemWordAttribute
        Inherits Attribute
        Public ReadOnly ActionItemWord As String
        Public Sub New(ByVal ActionItemWord As String)
            Me.ActionItemWord = ActionItemWord
        End Sub
    End Class
End Namespace
